﻿@{ Layout = "../../Views/Shared/_LayoutPhone.cshtml";}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<div class="container-fluid">
    <div class="row align-items-center has-background-img min-height-300">
        <figure class="background-img pink-gradient">
            <img src="~/GoTRI/img/singer-690117_640.jpg" alt="" class="">
        </figure>
        <div class="container">
            <div class="row align-items-center ">
                <div class="col-12 col-sm-auto text-center">
                    @*<a href="profile.html ">*@
                    <figure class="avatar avatar-150 mx-auto my-3">
                        @*<img src="~/GoTRI/img/user1.png" alt="">*@
                        <div id="div_nan"><img src='~/GoTRI/img/男.jpg' alt=''></div>
                        <div id="div_nv"><img src='~/GoTRI/img/女.jpg' alt=''></div>

                    </figure>
                    @*</a>*@
                </div>
                <div class="col-12 col-sm text-center text-sm-left text-white">
                    <h3 class="mb-0" id="KeHuXingMing"></h3>
                    <p class="" id="NianLing"></p>
                    <p class="small" id="ShouJiHaoMa"><i class="material-icons">call</i></p>
                </div>
                <div class="text-center text-sm-right col-12 col-sm-auto mb-3">
                    <div id="querendaofang" style="float:left ; margin-left: 10%; display:none;"><a class="btn btn-success success-gradient" onclick="QueRenDaoFang()">确认到访</a></div>
                    <div id="genjinpanduan" style="float:left ; margin-left: 10px; display:none;"><a class="btn btn-success success-gradient" onclick="genjin()">跟进</a></div>
                    <div id="baobeipanduan" style="float:left ; display:none;"><a class="btn btn-primary primary-gradient ml-2" onclick="baobei()">报备</a></div>
                    <div id="genjinjilupandaun" style="float:left ; display:none;"><a class="btn btn-primary primary-gradient ml-2" onclick="genjinjilu()">跟进记录</a></div>
                    <div id="btn_LaiFang" style="float:left ;"><a class="btn btn-success success-gradient" onclick="laifang()">到访</a></div>
                </div>
            </div>
        </div>

    </div>
</div>
<div class="card mb-4">
    <div class="card-header border-bottom">
        <div class="media">

            <div class="media-body">
                <h3 class="my-0 content-color-primary">客户信息</h3>
            </div>
        </div>
    </div>
    <div class="card-body">
        <ul class="list-group list-group-flush w-100">
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">意向楼层</h6>
                        <p id="YiXiangLouCeng"></p>
                    </div>
                </div>
            </li>
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">意向套数</h6>
                        <p id="YiXiangTaoShu"></p>
                    </div>
                </div>
            </li>
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">意向面积</h6>
                        <p id="YiXiangMianJi"></p>
                    </div>
                </div>
            </li>
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">意向户型</h6>
                        <p id="YiXiangHuXing"></p>
                    </div>
                </div>
            </li>
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">意向用途</h6>
                        <p id="YiXiangYongTu"></p>
                    </div>
                </div>
            </li>
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">关注内容</h6>
                        <p id="GuanZhuNeiRong"></p>
                    </div>
                </div>
            </li>
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">意向总价</h6>
                        <p id="YiXiangZongJia"></p>
                    </div>
                </div>
            </li>
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">意向单价</h6>
                        <p id="YiXiangDanJia"></p>
                    </div>
                </div>
            </li>
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">联名客户</h6>
                        <p id="LianMingKeHu"></p>
                    </div>
                </div>
            </li>
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">客户备注</h6>
                        <p id="KeHuiBeiZhu"></p>
                    </div>
                </div>
            </li>
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">职业身份</h6>
                        <p id="ZhiYeShenFen"></p>
                    </div>
                </div>
            </li>
            <li class="list-group-item px-0">
                <div class="media experience">
                    <div class="media-body">
                        <h6 class="my-0 content-color-primary">家庭结构</h6>
                        <p id="JiaTingJieGou"></p>
                    </div>
                </div>
            </li>

        </ul>
    </div>
</div>
<div style="margin-bottom: 50px;padding-bottom:1px"></div>
<script>
    $(document).ready(function () {
        bangdingshuju();
    });
    function bangdingshuju() {
        var id = GetQueryString("KeHuId");
        $.ajax({
            type: "POST",
            url: "../PhoneKeHu/huibangkehu",
            cache: false,  //禁用缓存
            data: { KeHuId: id },  //传入组装的参数
            dataType: "json",
            success: function (result) {
                var json = result;
                $.each(json, function (index) {
                    var shuju = document.referrer;
                    var arr = shuju.split("/");
                    var shang = arr[parseInt(arr.length) - 1];
                    var LeiXing = GetQueryString("LeiXing");
                    if (LeiXing == "YiDaoFang") {
                        //$("#querendaofang").show();
                        document.getElementById("querendaofang").style.display = "block";
                        //$("#genjinpanduan").hide();
                        //$("#baobeipanduan").hide();
                        //$("#genjinjilupandaun").hide();
                        $("#KeHuXingMing").text("客户姓名:***");
                        $("#ShouJiHaoMa").text("手机号码:***********");
                    } else {
                        $("#genjinpanduan").show();
                        $("#baobeipanduan").show();
                        $("#genjinjilupandaun").show();
                        //$("#querendaofang").hide();
                        $("#KeHuXingMing").text("客户姓名:" + json[index].KeHuXingMing);
                        $("#ShouJiHaoMa").text("手机号码:" + json[index].ShouJiHaoMa);
                    }
                    $("#NianLing").text("年龄:" + json[index].NianLing + " | 意向等级:" + json[index].YiXiangDengJi);
                    $("#LianMingKeHu").text(json[index].LianMingKeHu);
                    $("#KeHuiBeiZhu").text(json[index].KeHuBeiZhu);
                    $("#ZhiYeShenFen").text(json[index].ZhiYeShenFen);
                    $("#JiaTingJieGou").text(json[index].JiaTingJieGou);
                    $("#YiXiangLouCeng").text(json[index].YiXiangLouCeng);
                    $("#YiXiangTaoShu").text(json[index].YiXiangTaoShu);
                    $("#YiXiangMianJi").text(json[index].YiXiangMianJi);
                    $("#YiXiangHuXing").text(json[index].YiXiangHuXing);
                    $("#YiXiangYongTu").text(json[index].YiXiangYongTu);
                    $("#YiXiangYongTu").text(json[index].YiXiangYongTu);
                    $("#GuanZhuNeiRong").text(json[index].GuanZhuNeiRong);
                    $("#YiXiangZongJia").text(json[index].YiXiangZongJia);
                    $("#YiXiangDanJia").text(json[index].YiXiangDanJia);
                    if (json[index].XingBie == "男") {
                        $("#div_nan").show();
                        $("#div_nv").hide();
                    } else {
                        $("#div_nan").hide();
                        $("#div_nv").show();
                    }
                })

            }
        });
    }
    function baobei() {
        var id = GetQueryString("KeHuId");
        window.location.href = "BaoBei?KeHuId=" + id + "";
    }
    function genjin() {
        var id = GetQueryString("KeHuId");
        window.location.href = "GenJin?KeHuId=" + id + "";
    }
    function genjinjilu() {
        var id = GetQueryString("KeHuId");
        window.location.href = "KeHuGenJinJiLu?KeHuId=" + id + "";
    }
    function laifang() {
        var id = GetQueryString("KeHuId");
        window.location.href = "LaiFang?KeHuId=" + id + "";
    }
    function QueRenDaoFang() {
        $.ajax({
            type: "POST",
            url: "../PhoneKeHu/QueRenDaoFang",
            cache: false,  //禁用缓存
            data: { "Id": getQuery("KeHuId") },
            dataType: "text",
            success: function (response) {
                if (response == "true") {
                    swal("成功提示!", "操作成功!两秒后自动返回。", "success");
                    setTimeout(function () { window.location.href = "../PhoneKeHu/KeHuLeiXingList?ZhuangTai=已到访"; }, 2000);
                    //location.href = "../PhoneKeHu/KeHuLeiXingList?ZhuangTai=已到访";
                } else {
                    alert("操作失败");
                }
            }
        });
    }
    //获取数据方法
    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]); return null;
    }
    function getQuery(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]); return null;
    }
</script>